<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>利用函数求所有参数中的最大值</title>
    <script>
        /*function fn(){
            console.log(arguments);
            console.log(arguments.length);
            console.log(arguments[1]);
        }
        fn(1,2,3);*/
        function getMax(){
            var max = arguments[0];
            for(var i = 1; i <arguments.length; i++){
                if(arguments[i] > max){
                    max = arguments[i];
                }
            }
            return max;
        }
        console.log(getMax(1,2,3));
        console.log(getMax(1,2,3,4,5));
        console.log(getMax(1,2,34,666,5,100));
    </script>
</head>
<body>

</body>
</html>